﻿using System;
using System.Windows.Interactivity;
using System.Windows.Media;
using PairingMatrix.ViewModel;

namespace PairingMatrix.View.Behavior
{

    public class TabSelectButtonMouseClickBehavior : Behavior<TabSelectButton>
    {
        private double zoomInScale;

        protected override void OnAttached()
        {
            zoomInScale = 0.8;
            
            AssociatedObject.MouseLeftButtonDown += (sender, e) =>
                                                    {
                                                        AssociatedObject.CaptureMouse();
                                                        AssociatedObject.scaleTransform.ScaleX = zoomInScale;                                                        
                                                        AssociatedObject.scaleTransform.ScaleY = zoomInScale;
                                                    };
 
            AssociatedObject.MouseLeftButtonUp += (sender, e) =>
                                                  {
                                                      AssociatedObject.ReleaseMouseCapture();
                                                      AssociatedObject.IsSelected = true;
                                                      AssociatedObject.Command.Execute(null);
                                                  };
 
        }
    }
}
